﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VCodeEditor.Document;

namespace VCodeEditor.Styles.Colors
{
	/// <summary>
	/// 颜色样式基类
	/// </summary>
	internal class StyleColorBase
	{
		protected StyleColorBase(string name)
		{
			this.Name = name;
			this.ColorStyles = new Dictionary<string, ColorStyle>();
		}

		private Dictionary<string, ColorStyle> ColorStyles;

		/// <summary>
		/// 名称
		/// </summary>
		public string Name { get; }

		/// <summary>
		/// 获取颜色
		/// </summary>
		/// <param name="name"></param>
		/// <returns></returns>
		public ColorStyle this[string name]
		{
			get
			{
				if (this.ColorStyles.ContainsKey(name))
					return this.ColorStyles[name];
				return null;
			}
			protected set
			{
				this.ColorStyles[name] = value;
			}
		}

		public bool Contains(string name)
		{
			return this.ColorStyles.ContainsKey(name);
		}
	}
}
